package com.codi.bus.core.resultModel;

import com.alibaba.fastjson.annotation.JSONField;
import com.codi.base.domain.BaseDomain;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class BaseResult extends BaseDomain {
    private static final long serialVersionUID = 1L;

    @JSONField(ordinal = -1003)
    private Boolean success = true;

    @JSONField(ordinal = -1002)
    private Integer errorCode;

    @JSONField(ordinal = -1001)
    private String errorMessage;

    @JSONField(ordinal = -1000)
    private String errorField;

    private Object result;

    // 错误类别
    private String errorType;

    public BaseResult() {
        this.success = true;
    }

    public BaseResult(boolean success) {
        this.success = success;
    }

    public BaseResult(boolean success, Integer errorCode) {
        this.success = success;
        this.errorCode = errorCode;
    }

    public BaseResult(boolean success, String errorType, Integer errorCode) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorType = errorType;
    }

    public BaseResult(boolean success, String errorMsg) {
        this.success = success;
        this.errorMessage = errorMsg;
    }

    public BaseResult(boolean success, String errorMsg, String errorType) {
        this.success = success;
        this.errorMessage = errorMsg;
        this.errorType = errorType;
    }
}
